package com.example.demoa;

import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        /*findViewById(R.id.btn_1).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent();
                intent.setAction(Intent.ACTION_VIEW);
                intent.setData(Uri.parse("http://www.baidu.com"));



                //第一种显示方法
               *//* intent.setClass(MainActivity.this,SecondActivity.class);

                startActivity(intent);*//*

               //第二种显示方法
               *//*String package1 = "com.example.demoa";
               String classname = "com.example.demoa.SecondActivity";

                intent.setClassName(package1,classname);
                startActivity(intent);*//*

               //第三种显示方法
                *//*intent.setClassName("com.example.demoa","com.example.demoa.SecondActivity");
                startActivity(intent);*//*
            }
        });*/
        //打开网址
        /*findViewById(R.id.btn_2).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent();
                intent.setAction(Intent.ACTION_VIEW);
                intent.setData(Uri.parse("http://www.baidu.com"));
                startActivity(intent);
            }
        });*/

        //打开地图
        /*findViewById(R.id.btn_3).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent();
                intent.setAction(Intent.ACTION_VIEW);
                intent.setData(Uri.parse("http://f.amap.com/48dDl_0AF4OEj"));
                startActivity(intent);
            }
        });*/

       //隐式跳转
        findViewById(R.id.btn_4).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent();
                /*intent.setAction("I_WANT_EAT");
                intent.addCategory("NIU_ROU_FAN");

                startActivity(intent);*/

                intent.setAction("TextActivity");
                startActivity(intent);
            }
        });
    }
}
